//
//  SearchCard.swift
//  shop
//
//  Created by chen on 2025/5/13.
//

import SwiftUI

struct SearchCard: View {
    
    @ObservedObject var router:Router
    
    var body: some View {
        Button {
            router.to(.searchView)
        } label: {
            HStack(spacing: 10){
                Image(systemName: "magnifyingglass")
                    .font(.system(size: 16))
                    .foregroundStyle(.gray)
                
                Text("搜索商品")
                    .font(.system(size: 14))
                    .foregroundStyle(.gray)
                    .padding(.vertical, 10)
                
                Spacer()
                
                Text("搜索")
                    .padding(.vertical, 8)
                    .font(.system(size: 14))
                    .foregroundStyle(.white)
                    .padding(.horizontal, 18)
                    .background(Color.red)
                    .cornerRadius(15)
            }
            .padding(.vertical, 2)
            .padding(.leading, 15)
            .padding(.trailing, 5)
            .background(.white)
            .cornerRadius(15)
            .overlay(
                RoundedRectangle(cornerRadius: 15)
                    .stroke(Color.red, lineWidth: 1)
            )
            .padding(.horizontal, 10)
        }
        .buttonStyle(PlainButtonStyle())
    }
}

#Preview {
    SearchCard(router: Router.shared)
}
